import request from '@/utils/request';
import qs from 'qs';
import type { ResponseData } from '../typing';
export function getMedicalProjectTree(): Promise<any> {
    return request.get(`/yfwy/medical/project/tree`);
}
export function getMedicalBuildTree(projectCode: string): Promise<any> {
    return request.get(`/yfwy/medical/project/tree/${projectCode}`);
}
// 响应接口
export interface GetMedicalBasicDepartmentPageRes {
    /* */
    code: number;
    /* */
    data: {
        /* */
        size: number;
        /* */
        total: number;
        /* */
        current: number;
        /* */
        records: {
            /* */
            createTime: Record<string, unknown>;
            /* */
            updateTime: Record<string, unknown>;
            /* */
            creator: number;
            /* */
            updater: number;
            /*主键 */
            id: number;
            /*楼层ID */
            buildingId: number;
            /*科室名称 */
            deptName: string;
            /*科室负责人 */
            deptCharge: string;
            /*科室电话 */
            deptTel: string;
            /*默认医废类型字典项key */
            medicalWasteType: string;
            /*默认医废类型字典项值 */
            medicalWasteTypeValue: string;
            /*医废收取时是否需要双方签字:0->否,1->是 */
            collectSign: number;
            /*医废收取时是否录入房间号:0->否,1->是 */
            collectRoomNo: number;
            /*运送单取单时是否需要双方签字:0->否,1->是 */
            deliveryPickingSign: number;
            /*运送单送达时是否需要双方签字:0->否,1->是 */
            deliveryArriveSign: number;
            /*二维码地址 */
            qrcodeUrl: string;
        }[];
        /* */
        pages: number;
    };
    /* */
    msg: string;
}
export interface QueryMedicalBasicDepartmentParams {
    buildingId: string;
    deptName?: string;
    current?: string;
    size?: string;
}
/**
 * 获得科室分页
 * @param {string} buildingId 楼层ID
 * @param {string} deptName 科室名称
 * @param {string} current 当前第几页(默认1)
 * @param {string} size 每页条数(默认20)
 * @returns
 */
export function getMedicalBasicDepartmentPage(params: Partial<QueryMedicalBasicDepartmentParams>): Promise<GetMedicalBasicDepartmentPageRes> {
    return request.post(`/yfwy/medical-basic-department/page`, params);
}
// 根据项目code获取科室列表
export function getMedicalBasicDepartmentList(projectCode: any) {
    return request.get(`/openapi/medical-basic-department/${projectCode}`);
}
// 响应接口
export interface GetMedicalBasicDepartmentRes {
    /* */
    code: number;
    /* */
    data: {
        /* */
        createTime: Record<string, unknown>;
        /* */
        updateTime: Record<string, unknown>;
        /* */
        creator: number;
        /* */
        updater: number;
        /*主键 */
        id: number;
        /*楼层ID */
        buildingId: number;
        /*科室名称 */
        deptName: string;
        /*科室负责人 */
        deptCharge: string;
        /*科室电话 */
        deptTel: string;
        /*默认医废类型字典项key */
        medicalWasteType: string;
        /*默认医废类型字典项值 */
        medicalWasteTypeValue: string;
        /*医废收取时是否需要双方签字:0->否,1->是 */
        collectSign: number;
        /*医废收取时是否录入房间号:0->否,1->是 */
        collectRoomNo: number;
        /*运送单取单时是否需要双方签字:0->否,1->是 */
        deliveryPickingSign: number;
        /*运送单送达时是否需要双方签字:0->否,1->是 */
        deliveryArriveSign: number;
        /*二维码地址 */
        qrcodeUrl: string;
    };
    /* */
    msg: string;
}
/**
 * 获得科室
 * @param {string} id
 * @returns
 */
export function getMedicalBasicDepartment(id: number): Promise<GetMedicalBasicDepartmentRes> {
    return request.get(`/yfwy/medical-basic-department/${id}`);
}
/**
 * 删除科室
 * @param {string} id
 * @returns
 */
export function deleteMedicalBasicDepartment(id: string): Promise<ResponseData<boolean>> {
    return request.delete(`/yfwy/medical-basic-department/${id}`);
}
// 参数接口
export interface CreateMedicalBasicBuildingParams {
    /*项目code */
    projectCode: string;
    /*楼栋名 */
    name: string;
    /*楼层(开始层) */
    from: number;
    /*楼层(结束层) */
    to: number;
}
/**
 * 创建楼层
 * @param {object} params YfwyMedicalBasicBuildingCreateReqArgs
 * @param {string} params.projectCode 项目code
 * @param {string} params.name 楼栋名
 * @param {number} params.from 楼层(开始层)
 * @param {number} params.to 楼层(结束层)
 * @returns
 */
export function CreateMedicalBasicBuilding(params: CreateMedicalBasicBuildingParams): Promise<ResponseData<boolean>> {
    return request.post(`/yfwy/medical-basic-department/building`, params);
}
// 参数接口
export interface CreateMedicalBasicDepartmentParams {
    /*楼层ID */
    buildingId: number;
    /*科室名称 */
    deptName: string;
    /*科室负责人 */
    deptCharge: string;
    /*科室电话 */
    deptTel: string;
    /*默认医废类型字典项key */
    medicalWasteType: string;
    /*默认医废类型字典项值 */
    medicalWasteTypeValue: string;
    /*医废收取时是否需要双方签字:0->否,1->是 */
    collectSign: number;
    /*医废收取时是否录入房间号:0->否,1->是 */
    collectRoomNo: number;
    /*运送单取单时是否需要双方签字:0->否,1->是 */
    deliveryPickingSign: number;
    /*运送单送达时是否需要双方签字:0->否,1->是 */
    deliveryArriveSign: number;
}
/**
 * 创建科室
 * @param {object} params 管理后台 - 科室创建 Request VO
 * @param {number} params.buildingId 楼层ID
 * @param {string} params.deptName 科室名称
 * @param {string} params.deptCharge 科室负责人
 * @param {string} params.deptTel 科室电话
 * @param {string} params.medicalWasteType 默认医废类型字典项key
 * @param {string} params.medicalWasteTypeValue 默认医废类型字典项值
 * @param {number} params.collectSign 医废收取时是否需要双方签字:0->否,1->是
 * @param {number} params.collectRoomNo 医废收取时是否录入房间号:0->否,1->是
 * @param {number} params.deliveryPickingSign 运送单取单时是否需要双方签字:0->否,1->是
 * @param {number} params.deliveryArriveSign 运送单送达时是否需要双方签字:0->否,1->是
 * @returns
 */
export function createMedicalBasicDepartment(params: CreateMedicalBasicDepartmentParams): Promise<ResponseData<boolean>> {
    return request.post(`/yfwy/medical-basic-department`, params);
}
// 参数接口
export interface UpdateMedicalBasicDepartmentParams {
    /*楼层ID */
    buildingId: number;
    /*科室名称 */
    deptName: string;
    /*科室负责人 */
    deptCharge: string;
    /*科室电话 */
    deptTel: string;
    /*默认医废类型字典项key */
    medicalWasteType: string;
    /*默认医废类型字典项值 */
    medicalWasteTypeValue: string;
    /*医废收取时是否需要双方签字:0->否,1->是 */
    collectSign: number;
    /*医废收取时是否录入房间号:0->否,1->是 */
    collectRoomNo: number;
    /*运送单取单时是否需要双方签字:0->否,1->是 */
    deliveryPickingSign: number;
    /*运送单送达时是否需要双方签字:0->否,1->是 */
    deliveryArriveSign: number;
    /*主键 */
    id: number;
}
/**
 * 更新科室
 * @param {object} params 管理后台 - 科室更新 Request VO
 * @param {number} params.buildingId 楼层ID
 * @param {string} params.deptName 科室名称
 * @param {string} params.deptCharge 科室负责人
 * @param {string} params.deptTel 科室电话
 * @param {string} params.medicalWasteType 默认医废类型字典项key
 * @param {string} params.medicalWasteTypeValue 默认医废类型字典项值
 * @param {number} params.collectSign 医废收取时是否需要双方签字:0->否,1->是
 * @param {number} params.collectRoomNo 医废收取时是否录入房间号:0->否,1->是
 * @param {number} params.deliveryPickingSign 运送单取单时是否需要双方签字:0->否,1->是
 * @param {number} params.deliveryArriveSign 运送单送达时是否需要双方签字:0->否,1->是
 * @param {number} params.id 主键
 * @returns
 */
export function updateMedicalBasicDepartment(params: UpdateMedicalBasicDepartmentParams): Promise<ResponseData<boolean>> {
    return request.put(`/yfwy/medical-basic-department`, params);
}
// 导出科室二维码
export function exportMedicalBasicDepartment(params: any): Promise<Blob> {
    return request.post(`/yfwy/medical-basic-department/export`, params, {
        responseType: 'blob',
    });
}

export function queryDeptsByProjectcodes(params: any): Promise<ResponseData<any>> {
    return request.post(`/yfwy/common/caregiver-department/tree/rooms`, params);
}

export function queryDeptsByProjectcode(projectCode: string): Promise<ResponseData<any>> {
    return request.get(`/yfwy/common/caregiver-department/tree/rooms/${projectCode}`);
}
